function manageUser (newGroup, userId, blogId) {
	$.ajax ({
		url: baseURI + '/blogs/ajax_set_blog_member/' + newGroup + '/' + userId + '/' + blogId + '?scode=' + scode,
		dataType: 'xml',
		type: 'get',
		error: function () { new Error ('Произошла ошибка!'); },
		success: function (xml) {
			var result = $(xml).find('result').text();
			
			if (result == '0') {
				new Error ('Произошла ошибка!');
				return;
			}
			
			if (newGroup == 'admin') {
				$('#user_control_'+userId).html (
					'<button disabled="disabled"><img src="' + baseURI + '/images/blog-members-manager-admin.png"></button>' +
					'<button onclick="manageUser (\'moderator\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-moderator.png"></button>' +
					'<button onclick="manageUser (\'member\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-member.png"></button>'
				);
			} else if (newGroup == 'moderator') {
				$('#user_control_'+userId).html (
					'<button onclick="manageUser (\'admin\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-admin.png"></button>' +
					'<button disabled="disabled"><img src="' + baseURI + '/images/blog-members-manager-moderator.png"></button>' +
					'<button onclick="manageUser (\'member\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-member.png"></button>'
				);
			} else {
				$('#user_control_'+userId).html (
					'<button onclick="manageUser (\'admin\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-admin.png"></button>' +
					'<button onclick="manageUser (\'moderator\', '+userId+', '+blogId+');"><img src="' + baseURI + '/images/blog-members-manager-moderator.png"></button>' +
					'<button disabled="disabled"><img src="' + baseURI + '/images/blog-members-manager-member.png"></button>'
				);
			} 
		}
	});
}